package com.github.ldw4033.spring.controller.converter;

import org.springframework.core.convert.converter.Converter;

import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Date;

/**
 * Created by liudw on 2015/8/1 0001.
 */
public class CustomDateConverter implements Converter<String,Date>{
    @Override
    public Date convert(String source) {

        try {
           return new SimpleDateFormat("yyyy-MM-dd hh:mm:ss").parse(source);
        } catch (ParseException e) {
            e.printStackTrace();
        }
        return null;
    }
}
